<template>
<router-view></router-view>
</template>

<script>
// import HomePage from "./components/WelcomePage.vue";
import router from "./router";
import {onMounted, onBeforeMount, onActivated} from 'vue'
import axios from "axios";
import constant from "./constant";
import {useStore} from "vuex";

export default {
  name: 'App',
  components: {
    // HomePage
  },
  setup() {
    const store = useStore()
    onBeforeMount(() => {
      axios.post("/api/autoLogin").then((res) => {
        if (res.status === constant.ResponseCode.SUCCESS) {
          store.state.user = res.data
        }

        console.log("autologin",store.state.user)
      })

    })
    onMounted(() => {
      router.replace('/')
    })

    return {

    }
  }
}
</script>